import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { HttpProvider } from '../http/http';

/*
  Generated class for the BusiProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class BusiProvider {

  constructor(private httpservce:HttpProvider) {
    console.log('Hello BusiProvider Provider');
  }
  login(username, password,type) {
    let param = {
      "username": username,
      "password": password,
      "type":type
    }
    return this.httpservce.postLoading("authen/getToken", param);
  }
  getAllMetting(sfsh){
    let param={
      "sfsh":sfsh
    }
    return this.httpservce.postLoading("metting/getMettingList", param);
  }
  getMettingDetail(mettingid){
    let param={
      "mettingid":mettingid
    }
    return this.httpservce.postLoading("metting/getMettingDetail", param);
  }
  mettingsh(mettingid){
    let param={
      "mettingid":mettingid
    }
    return this.httpservce.postLoading("metting/mettingsh", param);
  }
  getSysUserList(sfsh){
    let param={
      "sfsh":sfsh
    }
    return this.httpservce.postLoading("user/getSysUserList", param);
  }

  getUserDetail(userid){
    let param={
      "userid":userid
    }
    return this.httpservce.postLoading("user/getUserDetail", param);
  }
  userSh(userid){
    let param={
      "userid":userid
    }
    return this.httpservce.postLoading("user/userSh", param);
  }
  getCurrentUserDetail(){
    return this.httpservce.postLoading("user/getCurrentUserDetail");
  }

  passwordchange(passwordold, passwordnew) {
    let param = {
      "passwordold": passwordold,
      "passwordnew": passwordnew
    }
    return this.httpservce.postLoading("user/changeCurrentPassword", param);
  }

  appUserModify(body) {
    return this.httpservce.postLoading("user/appUserModify", null, body);
  }
  userAdd(body){
    return this.httpservce.postLoading("user/userAdd", null, body);
  }
  getMyMettingList(type){
    let param={
      type:type
    }
    return this.httpservce.postLoading("metting/getMyMeetingList", param);
  }
  addMetting(body){
    return this.httpservce.postLoading("metting/addMetting", null,body);
  }
  getUserList(){
    return this.httpservce.postLoading("user/getUserList");

  }
  saveSummary(mettingid,summary){
    let param={
      mettingid:mettingid,
      summary:summary
    }
    return this.httpservce.postLoading("metting/saveSummary", param);

  }
  getMessages(mettingid, fromdate?){
    let param={
      mettingid:mettingid,
      fromdate:fromdate
    }
    return this.httpservce.postLoading("metting/getMessages", param);
  }
}
